package com.study.service;

import com.study.annotation.NeedSetFieldValue;
import com.study.dao.OrderDao;
import com.study.model.Order;
import com.study.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: chenhs
 * @date: Created in 6:45 2019/11/28
 **/
@Service
public class OrderService {

    @Autowired
    private OrderDao orderDao;

    @NeedSetFieldValue
    public Page<Order> pageQuery(String customerId, int pageNum, int pageSize){

        Page<Order> page = new Page<>();
        List<Order> list = this.orderDao.findAll();
        page.setItems(list);
        page.setPageNum(pageNum);
        page.setPageSize(pageSize);
        page.setTotalCount(list.size());

        return page;
    }

}
